<?php
	require_once('Connections/conexao.php'); 

	$id = $_SESSION['id'];

	mysql_select_db($database_conexao, $conexao);	
	$queryUser = "SELECT * FROM usuarios WHERE id = '$id'";
	$User = mysql_query($queryUser, $conexao) or die(mysql_error());
	$rowUser = mysql_fetch_assoc($User);
	$totalRowsUser = mysql_num_rows($User);
?>

<div id="safe-cadastrar">
<h1>Conta no Bagulho</h1>
<hr />

<!-- LADO ESQUERDO -->
<div id="cad-left">
   	<a href="?pg=perfil"><h2 class="cad-select">Dados Pessoais</h2></a>    
   	<a href="?pg=acesso"><h2>Alterar Senha</h2></a>
   	<a href="?pg=inbox"><h2>Inbox</h2></a>    
</div>


<!-- LADO DIREITO -->
<div id="cad-right">
	<h2 class="cad-title" style="width:195px;">Dados Pessoais</h2>
    <hr />
    
    <form name="editarUsuario" method="post" action="files/lib/php/usuario-editar.php" enctype="multipart/form-data">
    	<input type="hidden" name="id_usuario" id="id_usuario" value="<?php echo $id; ?>" />
    	<table>
			<tr>
            	<td width="145"><div align="left">Nome</div></td>
                <td width="15"></td>
                <td width="224">Apelido</td>
           	</tr>
        	<tr>
            	<td><div align="right">
            	  <input type="text" name="nome" class="campo-cad" id="nome" value="<?php echo $rowUser['nome']; ?>" />
            	</div></td>
                <td></td>
                <td><input type="text" name="apelido" class="campo-cad" id="apelido" value="<?php echo $rowUser['apelido']; ?>" /></td>
           	</tr>           
            <tr height="10px">
	            <td></td>
                <td></td>
                <td></td>
            </tr>
            <tr>
              <td>Website / Blog</td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td><label for="website"></label>
              <input type="text" name="website" id="website" class="campo-cad"  value="<?php echo $rowUser['website']; ?>"/></td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
            </tr>
            <tr height="10px">
	            <td></td>
                <td></td>
                <td></td>
            </tr>
            <tr>
	            <td><div align="left">Data de Nascimento</div>                 
                </td>
	            <td>&nbsp;</td>
	            <td>&nbsp;</td>
            </tr>
            <tr>
              <td><input type="text" name="data_nascimento" id="data_nascimento" class="campo-cad" placeholder="dd/mm/aaaa" maxlength="10" value="<?php echo $rowUser['data_nascimento']; ?>"/></td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
            </tr>
            <tr height="10px">
	            <td></td>
                <td></td>
                <td></td>
            </tr>
        </table>
        
        <h2 class="cad-title" style="width:100px;">Imagem</h2>
	    <hr />
		<table>
			<tr>
            <?php if ($rowUser['imagem']) { ?>
	            <td width="110" id="imagem-box">
                	<a href="files/lib/php/apaga-imagem.php?id=<?php echo $id; ?>" title="Clique para excluir a imagem"><img src="files/images/users/<?php echo $rowUser['imagem']; ?>" width="110" height="125" /></a>
                </td>
            <?php } else { ?>
            	<td width="110"><img id="img_prev" src="#" alt="" width="110" height="125" /> </td>
            <?php } ?>
                <td>&nbsp;</td>
                <td width="236">
                	<p><b>Alterar Imagem</b></p>
                    <p style="font-size:12px; color:#999;">Você pode usar uma imagem em JPG, PNG ou GIF.</p>
                    <p style="font-size:12px; color:#999;">Tamanho preferencial: 110 x 125</p>                    
                    <br />
                    <input type='file' name="img1" id="img1" onchange="readURL(this);" />
                </td>
           	</tr>
        </table>        
        
        <div class="safe-botao">
 	       <input type="submit" name="atualizar" id="atualizar" value="Atualizar" class="box-form"/>
        </div>
    </form>
    
</div>

</div>